unit uOrderPreAppointHis;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore, dxSkinBlack,
  dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
  dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
  dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
  dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
  dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
  dxSkinXmas2008Blue, cxGroupBox, Data.DB, Datasnap.DBClient, ClientRowSet,
  cxStyles, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage,
  cxNavigator, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, cxTextEdit,
  cxEditRepositoryItems;

type
  TFrmOrderPreAppointHis = class(TForm)
    crsHis: TClientRowSet;
    dsHis: TDataSource;
    GrdBasic: TcxGrid;
    tvBasic: TcxGridDBTableView;
    lvEXP_COMP: TcxGridLevel;
    crsHisID: TStringField;
    crsHisSYS_ACCOUNT: TStringField;
    crsHisGROUP_CODE: TStringField;
    crsHisORDER_PRE_ID: TStringField;
    crsHisEMPNO: TStringField;
    crsHisEMPNAME: TStringField;
    crsHisEMPTEL: TStringField;
    crsHisREFUSAL_REASON: TStringField;
    crsHisVERSION: TIntegerField;
    crsHisSTATUS: TSmallintField;
    crsHisDISABLED: TSmallintField;
    crsHisREMARK: TStringField;
    crsHisCREATE_DT: TStringField;
    crsHisUPDATE_DT: TStringField;
    crsHisCUST_SRV_NO: TStringField;
    crsHisCUST_SRV_NAME: TStringField;
    tvBasicEMPNO: TcxGridDBColumn;
    tvBasicEMPNAME: TcxGridDBColumn;
    tvBasicEMPTEL: TcxGridDBColumn;
    tvBasicREFUSAL_REASON: TcxGridDBColumn;
    tvBasicSTATUS: TcxGridDBColumn;
    tvBasicCREATE_DT: TcxGridDBColumn;
    tvBasicUPDATE_DT: TcxGridDBColumn;
    tvBasicCUST_SRV_NO: TcxGridDBColumn;
    tvBasicCUST_SRV_NAME: TcxGridDBColumn;
    cxEditRepository1: TcxEditRepository;
    EditRepStatus: TcxEditRepositoryImageComboBoxItem;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmOrderPreAppointHis: TFrmOrderPreAppointHis;
  procedure OrderPreAppointHisShow(orderId: string);

implementation
uses uDm, ucommFunction;
{$R *.dfm}

procedure OrderPreAppointHisShow(orderId: string);
begin
  Application.CreateForm(TFrmOrderPreAppointHis, FrmOrderPreAppointHis);
  with FrmOrderPreAppointHis do
  try
    try
      crsHis.DisableControls;
      crsHis.Close;
      crsHis.CommandText := 'SELECT ' + GetClientRowSetColumns(crsHis) + ' FROM tsp_order_pre_appoint WHERE group_code=' + QuotedStr(userInfo.groupCode) +
        ' AND order_pre_id=' + QuotedStr(orderId) + ' ORDER BY create_dt DESC';
      crsHis.Open;
    finally
      crsHis.First;
      crsHis.EnableControls;
    end;
    ShowModal;
  finally
    FreeAndNil(FrmOrderPreAppointHis);
  end;
end;

procedure TFrmOrderPreAppointHis.FormCreate(Sender: TObject);
begin
  pSetCaption(Self);
end;

end.
